# -*- coding:utf-8 -*-

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *


class MyBrowser(QWidget):
    def __init__(self, parent=None):
        super(MyBrowser, self).__init__(parent)
        self.createLayout()

    def createLayout(self):
        self.setWindowTitle("Tom's Window")
        bl = QHBoxLayout()
        self._page = QWebPage()
        self._view = QWebView()
        self._view.setPage(self._page)
        self._window = QMainWindow()
        self._window.setCentralWidget(self._view)
        url = QUrl("./html/index.html")
        self._view.load(url)
        layout = QVBoxLayout()
        layout.addLayout(bl)
        layout.addWidget(self._window)

        self.setLayout(layout)

        # 设置大小
        screen = QDesktopWidget().screenGeometry()
        self.setWindowFlags(Qt.WindowMinMaxButtonsHint)
        self.setFixedSize(600, 800)
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)



